<%@ page language="java" contentType="text/html;charset=UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<!DOCTYPE html>
<html>
<head>
    <title>个人资料</title>
</head>
<body>
    <!-- 菜单及导航数据  -->
    <data id="info" nav="user" menu="profile" service="用户服务" action="个人资料">

	<!-- 业务部分  开始  -->
    <div class="row wrapper border-bottom white-bg page-heading animated zoomIn min-height">
       	<div class="row">
         <div class="col-lg-12">
             <div class="ibox float-e-margins">
             
	             <div class="col-lg-12">
	              <div class="ibox float-e-margins">
	                  <div class="ibox-title">
	                      <div class="row">
	                          <div class="col-sm-6 b-r"><h3 class="m-t-none m-b">个人资料</h3>
	                          	<p></p>
	                              <form role="form" id="updateForm">
	                                  <div class="form-group"><label>姓名<span class="red">*</span></label> <input type="text" name="name" id="name" maxlength="20" placeholder="名字" class="form-control" value="${sessionScope.LOGINED_USER.name}"></div>
	                                  <div class="form-group"><label>邮箱<span class="red">*</span> </label> <input type="mail" name="mail" id="mail" placeholder="邮箱" maxlength="30" required="required" class="form-control" value="${sessionScope.LOGINED_USER.mail}"></div>
	                                  <div class="form-group"><label>电话</label> <input type="tel" name="mobile" id="mobile" placeholder="手机号码" maxlength="15" required="required" class="form-control" value="${sessionScope.LOGINED_USER.mobile}"></div>
	                                  <div>
	                                      <button id="saveBtn" class="btn btn-sm btn-primary m-t-n-xs" type="button"><strong>保存</strong></button>
	                                  </div>
	                              </form>
	                          </div>
	                          <div class="col-sm-6"><h4>修改密码</h4>
	                              <p>点击箭头修改您的密码</p>
	                              <p class="text-center">
	                                  <a href="${ctx}/center/user/password/page.html"><i class="fa fa-sign-in big-icon"></i></a>
	                              </p>
	                          </div>
	                      </div>
	                  </div>
	              </div>
	          	</div>
             
             </div>
         </div>
     </div>
    </div>
    <!-- 业务部分  结束  -->

	<js>
	<script src="${ctx}/resource/v2/js/common.js"></script>
    <script type="text/javascript">
    $(document).ready(function() {
    	/* 表单校验事件 */
    	$('#name').blur(function(){
    		checkName($('#name'));
    	});
    	$('#mobile').blur(function(){
    		checkMobile($('#mobile'));
    	});
    	$('#mail').blur(function(){
    		checkEmail($('#mail'));
    	});
    	
    	/* 表单提交事件 */
	    $('#saveBtn').click(function(){
	        if(!checkName($('#name')) || !checkMobile($('#mobile')) || !checkEmail($('#mail')) ){
	        	return;
	       	}
	        $.ajax({
				url : "${ctx}/user/profile/update.do",
				type : "POST",
				data : $("#updateForm").serialize(),
				dataType : "json",
				success : function(rs) {
					if(rs.flag) {
						layer.alert(rs.msg, function(){
							window.location.reload();
						});
					} else {
						layer.msg(rs.msg);
					}
				}
			});
	   });
   	});
    </script>
    </js>
    
</body>

</html>